home *** CD-ROM | disk | FTP | other *** search
/ Software 2000 / Software 2000 Volume 1 (Disc 1 of 2).iso / utilities / u304.dms / in.adf / bits / File_Manipulation.AMOS / File_Manipulation.amosSourceCode
Encoding:
AMOS Source Code  |  1992-03-22  |  1.4 KB  |  55 lines

  1. ' File manipulation by James Lanng for the AMOS PD library 
  2.  
  3. ' FCOPY procedure is for copying files, from the filename SOURCE$ to the 
  4. ' destination file DESTINATION$, with the buffer in BUFFER in Kilobytes. 
  5. ' i.e. "FCOPY["S:Startup-Sequence","RAM:Startup-Sequence",8]" would copy 
  6. ' the startup sequence into RAM: with a buffer of 8K.
  7. '
  8. ' FMERGE is for merging two files, the first file is FIRST$, second SECOND$, 
  9. ' and the destination is called DESTINATION$.  
  10. ' i.e. "FMERGE["S:Startup-Sequence","S:Shell-startup","RAM:Startupfiles",8]
  11. ' would merge the startup sequence and shell startup into the ram disk, with 
  12. ' a buffer of 8K.
  13.  
  14. ' Please feel free to use these procedures within your own programs, no
  15. ' royalties are needed for commercial programs!
  16.  
  17. Procedure FCOPY[SOURCE$,DESTINATION$,BUFFER]
  18.    Open In 1,SOURCE$
  19.    Open Out 2,DESTINATION$
  20.    LF=Lof(1)
  21.    Do 
  22.       Exit If P>=LF
  23.       L=Min(BUFFER*1024,LF-P)
  24.       A$=Input$(1,L)
  25.       Print #2,A$;
  26.       Add P,L
  27.    Loop 
  28.    Close 1
  29.    Close 2
  30. End Proc
  31. Procedure FMERGE[FIRST$,SECOND$,DESTINATION$,BUFFER]
  32.    Open In 1,FIRST$
  33.    Open Out 2,DESTINATION$
  34.    LF=Lof(1)
  35.    Do 
  36.       Exit If P>=LF
  37.       L=Min(BUFFER*1024,LF-P)
  38.       A$=Input$(1,L)
  39.       Print #2,A$;
  40.       Add P,L
  41.    Loop 
  42.    Close 1
  43.    Open In 1,SECOND$
  44.    LF=Lof(1)
  45.    P=0
  46.    Do 
  47.       Exit If P>=LF
  48.       L=Min(BUFFER*1024,LF-P)
  49.       A$=Input$(1,L)
  50.       Print #2,A$;
  51.       Add P,L
  52.    Loop 
  53.    Close 1
  54.    Close 2
  55. End Proc